var tabs = document.querySelectorAll(".j-tab");
for(var d = 0; d < tabs.length; d++) {
	setTab(tabs[d]);
}

function setTab(tab) {
	var lis = tabs[d].getElementsByTagName("span");
	for(var i = 0; i < lis.length; i++) {
		(function(index) {
			lis[index].onclick = function() {
				var lilist = tab.querySelectorAll("#tab .ul-meun span.active");
				if(lilist[0]) {
					lilist[0].className = "";
				}
				var divs = document.getElementsByClassName("divitem1");
				for(var j = 0; j < divs.length; j++) {
					divs[j].style.display = "none";
				}
				divs[index].style.display = "block";
				this.className = "active";
			};
		})(i);
	}
}